//
//  CedarFindSpecifiedSubView.m
//  StarOrangeStaff
//
//  Created by lshenrong on 2020/6/23.
//  Copyright © 2020 lshenrong. All rights reserved.
//

#import "CedarFindSpecifiedSubView.h"

@implementation CedarFindSpecifiedSubView

//遍历获取指定类型的属性,替代就有的私有属性获取
UIView * CedarFindComfirmSubView(NSString *className ,UIView *superView) {
    Class specificView = NSClassFromString(className);
       if ([superView isKindOfClass:specificView]) {
           return superView;
       }
       
       if (superView.subviews.count > 0) {
           for (UIView *subView in superView.subviews) {
               UIView *targetView = CedarFindComfirmSubView(className, subView);
               if (targetView != nil) {
                   return targetView;
               }
           }
       }
       
       return nil;
}

@end
